
/**
 * 作者：lyn
 * 时间：2018.10.30
 * 此程序用来演示函数指针
 */
#include<iostream>
#include <vector>

struct faceInfo_t {
    float yaw = 100.0;
    float pitch = 100.0;
    float roll = 100.0;
    int x = 0;
    int y = 0;
    int w = 0;
    int h = 0;
};

struct traceResult_t {
    std::string imgJpg; // 跟踪结果人头 Mat .
    faceInfo_t faceXyYPR; // 人头位置和姿态
    int traceID; // 追踪模块中的追踪ID
    std::string camID;
};

struct traceInfo_t {
    std::string modelPath;
    float threshHold;
};

int callBackFun(const std::string camID, const std::vector<traceResult_t> vecRet) {
    std::cout << camID << std::endl;
    for (auto node:vecRet) {
        std::cout << node.traceID <<
                  node.faceXyYPR.x << std::endl;
    }
}

typedef int (*TCallBackF)(std::string camID, std::vector<traceResult_t>);

int main() {
//    int (*add)(int, int) = addfunc;
    TCallBackF add = NULL;
    add = callBackFun;

    std::vector<traceResult_t> vecRet;
    traceResult_t node;
    node.camID = "woshini";
    node.traceID = 99;
    node.faceXyYPR.x = 888;
    vecRet.push_back(node);


    int result = add("fdafdasfa", vecRet);
    std::cout << "通过函数指针调用函数进行计算结果：" << result << std::endl;

    return 0;
}



